package a66weding.com.jiehuntong.activity.me;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import a66weding.com.jiehuntong.MainActivity;
import a66weding.com.jiehuntong.R;
import a66weding.com.jiehuntong.application.GlobalApplication;

/**
 * 这是支付成功的界面
 * Created by Administrator on 2016/8/4.
 */
public class MePaySucceedActivity extends MeBaseActivity implements View.OnClickListener{
    private LinearLayout mBackLay;
    private TextView mBackContentTv;
    private TextView mHeaderTitleTv;
    private TextView mRightTitleTv;

    private TextView mTotalPayTv;
    private TextView mOrderNumTv;
    private Button toOrderBtn;
    private Button toShoppingBtn;

    private String totalPay;
    private String orderNumber;
    private  int flag;
    private TextView zfs;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_me_pay_succeed);
        ((GlobalApplication)getApplication()).getActivityManager().addActivity("MePaySucceedActivity",this);

        Intent intent = getIntent();
        if(intent!=null) {
            totalPay = intent.getStringExtra("totalPay");
            orderNumber = intent.getStringExtra("orderNumber");
            flag = intent.getIntExtra("flag",-1);
        }

        initview();
    }

    public void initview () {
        mBackLay = (LinearLayout) findViewById(R.id.lay_head_backlay);
        mBackContentTv = (TextView) findViewById(R.id.headleft_title_tv);
        mHeaderTitleTv = (TextView) findViewById(R.id.headcenter_title_tv);
        mRightTitleTv = (TextView) findViewById(R.id.headright_title_tv);
        zfs = (TextView) findViewById(R.id.zfs);
        if (flag==1){
            zfs.setText("微信");
        }
        mBackContentTv.setText("返回");
        mHeaderTitleTv.setText("支付成功");
        mRightTitleTv.setVisibility(View.GONE);


        mTotalPayTv = (TextView) findViewById(R.id.tv_totalPay);
        mOrderNumTv = (TextView) findViewById(R.id.tv_orderNumber);
        toOrderBtn = (Button) findViewById(R.id.btn_toMyorder);
        toShoppingBtn = (Button) findViewById(R.id.btn_toShopping);

        mBackLay.setOnClickListener(this);
        toOrderBtn.setOnClickListener(this);
        toShoppingBtn.setOnClickListener(this);

        mTotalPayTv.setText("￥ "+totalPay);
        mOrderNumTv.setText(orderNumber);
    }


    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.lay_head_backlay: //点击我的，返回到上一级界面
                finish();

                break;
            case R.id.btn_toMyorder: //我的订单
                intent.setClass(this,MeIndentActivity.class);
                startActivity(intent);
                finish();

                break;
            case R.id.btn_toShopping: //继续购物
                intent.setClass(this, MainActivity.class);
                ((GlobalApplication) getApplication()).getMainActivityManager().exitApp(); //获取到全部的Activity弹栈退出
                startActivity(intent);
                finish();
                break;


        }
    }
}
